package Java;

import java.util.Scanner;

public class work29 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[][] a = new int[3][3];
		int sum = 0;
		for(int i=0;i<=2;i++){
			for(int j = 0;j<=2;j++){
				a[i][j]=sc.nextInt();
			}
		}
		for(int i=0;i<=2;i++){
			for(int j = 0;j<=2;j++){
				if(i==j||i+j==2){
					sum +=a[i][j];
				}
			}
		}
		System.out.println(sum);
	}
}
